#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time    : 2021/12/6 5:04 下午
# @Author  : WangZhixing

from .arch import from_rsf
from .a2a import a2a
from .c2c import c2c_cvg
import os
def Hadoop(file,gr_path):
    if gr_path==None:
        fileg=os.path.join(os.path.dirname(os.path.abspath(__file__)),"ground-truth/hadoop_gt.rsf")
    else:
        fileg=gr_path
    recovered = from_rsf(file)
    ground_truth = from_rsf(fileg)
    a2am=round(100*a2a(recovered, ground_truth))
    c2c0_8 = round(100 * c2c_cvg(recovered, ground_truth, threshold=0.8))
    c2c0_5=round(100*c2c_cvg(recovered, ground_truth, threshold=0.5))
    c2c0_3=round(100*c2c_cvg(recovered, ground_truth, threshold=0.3))
    c2c0_1=round(100*c2c_cvg(recovered, ground_truth, threshold=0.1))
    print("Hadoop项目的指标")
    print("a2a:"+str(a2am))
    print("c2c0_8："+str(c2c0_8))
    print("c2c0_5：" + str(c2c0_5))
    print("c2c0_3：" + str(c2c0_3))
    print("c2c0_1：" + str(c2c0_1))
    return len(recovered),a2am,c2c0_5,c2c0_3,c2c0_1

